package com.glory.xu.consumer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class ConsumerController {

    Logger logger = LoggerFactory.getLogger(ConsumerController.class);


    @Autowired
    private RestTemplate restTemplate;
    @Autowired
    HelloService helloService;

    @GetMapping("/getserver")
    public String getserver() {
        String xx=restTemplate.getForObject("http://hello-service/hello", String.class);
        return "consumer finish result:"+xx;
    }

    @GetMapping("/gettest")
    public String gettest(){
        return helloService.hello();
    }
}
